<?php

// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------

use think\Route;

//生成access_token，post访问Token类下的token方法
Route::post(':version/token', 'api/:version.Token/token');
//刷新token
Route::post(':version/refresh', 'api/:version.Token/refresh');

//注册一个资源路由，对应restful各个方法
Route::resource(':version/user', 'api/:version.User');
//restful方法中除restful api外的其他方法路由
Route::rule(':version/user/:id/fans', 'api/:version.User/fans');


//注册一个多模块的资源路由，对应各个模块的方法，减少不同模块都要定义资源路由
Route::resource(':type/:version/index', ':type/:version.Index');
Route::resource(':type/:version/goods', ':type/:version.Goods');


Route::rule(':type/:version/index/:id/images', ':type/:version.Index/images');


Route::miss('Error/index');

//生成签名，本地测试
Route::get(':version/sign', 'api/:version.Token/sign');

return [
    '__pattern__' => [
        'name' => '\w+',
    ],
];
